\HeaderA{VaR.gpd}{Value at Risk Calculation from Log-Likelihood Fit of General Pareto Distribution (GPD)}{VaR.gpd}
\keyword{ts}{VaR.gpd}
\begin{Description}\relax
Estimation of Value at Risk from log-likelihood fit of GPD.
\end{Description}
\begin{Usage}
\begin{verbatim}
VaR.gpd(ydat, p = 0.01, p.tr = 0.97, drift.appx = FALSE, init = c(1, 0.3), cflevel = 0.95)
\end{verbatim}
\end{Usage}
\begin{Arguments}
\begin{ldescription}
\item[\code{ydat}] Numeric vector of data for which VaR is to be calculated.
\item[\code{p}] Confidence level for VaR calculation.
\item[\code{p.tr}] Threshold for GPD fit.
\item[\code{drift.appx}] Logical; if \code{TRUE} VaR is calculated in non-zero drift approximation.
\item[\code{init}] Initial values for log-likelihood fit of GPD.
\item[\code{cflevel}] Confidence level for estimation of VaR and ES intervals.
\end{ldescription}
\end{Arguments}
\begin{Details}\relax
This function estimates Value at Risk and Expected Shortfall of a single risk factor with a given confidence by using a fit of Generalized
Pareto Distribution to the part of data exceeding a given threshold (Peak over Threshold (POT) Method). The input data transformed
to procentual daily return. Then, transformed data is sorted and only part exceeding a given threshold is hold. Threshold is calculated
according an expression \code{p.tr*std}. Log-likelihood fit is then applied to get values of VaR and ES. After that, confidence
intervals for this values are calculated (see reference for details).
\end{Details}
\begin{Value}
A list containing following components:
\begin{ldescription}
\item[\code{VaR}] Value at Risk for input data.
\item[\code{VaR.interval}] Lower and higher bounds of VaR estimation with confidence given by parameter \code{cflevel}.
\item[\code{ES}] Expected shortfall.
\item[\code{ES.interval}] Lower and higher bounds of ES estimation with confidence given by parameter \code{cflevel}.
\item[\code{data}] Same as \code{ydat}.
\item[\code{cdata}] Vector of data used for GPD fit.
\item[\code{conf.level}] Same as \code{p}.
\item[\code{tr}] Same as \code{p.tr}.
\item[\code{mean}] Mean value of \code{cdata}.
\item[\code{std}] Standard deviation of \code{cdata}.
\item[\code{gfit}] Best fit values of GPD.
\item[\code{int.conf.level}] Same as \code{cflevel}.
\end{ldescription}
\end{Value}
\begin{Author}\relax
T. Daniyarov
\end{Author}
\begin{References}\relax
Embrechts, P., Kluepelberg, C., and Mikosch, T. (1999) Modelling
Extremal Events for Insurance and Finance. Application of Mathematics. Springer.
2nd ed. (1st ed., 1997)
\end{References}
\begin{SeeAlso}\relax
\code{\LinkA{VaR.gpd.plots}{VaR.gpd.plots}}
\end{SeeAlso}
\begin{Examples}
\begin{ExampleCode}
data(exchange.rates)
attach(exchange.rates)
y <- USDJPY[!is.na(USDJPY)]
z <- VaR.gpd(y)
z$VaR
z$VaR.interval
z$ES
z$ES.interval
detach(exchange.rates)
\end{ExampleCode}
\end{Examples}

